package builder;

public class ResourcePoolConfig {
    private String poolName;
    private int initThread;
    private int coreThread;
    private int maxThread;

    private ResourcePoolConfig(String poolName){
        this.poolName = poolName;
    }

    public static class Builder{
        private String poolName;
        private int initThread;
        private int coreThread;
        private int maxThread;

        public ResourcePoolConfig build(){
            if(poolName == null){
                throw new RuntimeException("poolName not empty");
            }
            return new ResourcePoolConfig(poolName);
        }

        public Builder setPoolName(String poolName) {
            this.poolName = poolName;
            return this;
        }

        public Builder setInitThread(int initThread) {
            this.initThread = initThread;
            return this;
        }

        public Builder setCoreThread(int coreThread) {
            this.coreThread = coreThread;
            return this;
        }

        public Builder setMaxThread(int maxThread) {
            this.maxThread = maxThread;
            return this;
        }
    }

}
